package com.study.service.serviceImpl;

import com.study.dao.AppInforDao;
import com.study.entity.AppInfo;
import com.study.service.AppInforService;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.xml.ws.Service;
import java.util.List;

import static org.junit.Assert.*;

/**
 * Created by Administrator on 2017/10/18.
 */

public class AppInforServiceImplTest {
    ClassPathXmlApplicationContext context;
    @Before
    public void setUp() throws Exception{
        context=new ClassPathXmlApplicationContext("spring/spring-config.xml");
    }

    @After
    public void tearDown() throws Exception{
    }
    @Test
    public void addAppInfo() throws Exception {
        AppInfo appInfo=new AppInfo();
        appInfo.setAppName("冒险岛");
        appInfo.setAppType(2);
        AppInforService service = (AppInforService) context.getBean("appInforServiceImpl");
        service.addAppInfo(appInfo);

    }

    @Test
    public void findList() throws Exception {
        AppInforService service = (AppInforService) context.getBean("appInforServiceImpl");
        AppInfo appInfo=new AppInfo();
        appInfo.setAppName("快");
        List<AppInfo> list = service.findList(appInfo);
        System.out.println(list);
    }



@Test
    public void testFindOneById() throws Exception{
        AppInforService service= (AppInforService) context.getBean("appInforServiceImpl");
        AppInfo appInfo = (AppInfo) service.findOneById(3);
        System.out.println(appInfo);
    }

    @Test
    public void findAllList() throws Exception {
        AppInforService service = (AppInforService) context.getBean("appInforServiceImpl");
        List<AppInfo> list = service.findAllList();
        System.out.println(list);
    }

}
